<% term['key'] = term['key'].downcase if name == 'host_type' %>
<% current_param = params[name.to_sym].to_s.split(',') %>
<% active = current_param.include?(term['key']) %>
<li class='<%= 'active' if active %>'>
  <% if active %>
    <a href="<%= url_for(params.except(:host).merge(name.to_sym => current_param.reject{ |x| x == term['key'] }.join(','), page: nil).permit!) %>">
    	<input type='checkbox' checked>
    	<%= format_term(term['key']) %>
    </a>
  <% else %>
    <a href="<%= url_for(params.except(:host).merge(name.to_sym => current_param.push(term['key']).join(','), page: nil).permit!) %>">
    	<input type='checkbox'>
    	<%= format_term(term['key']) %>
    </a>
    <small><%= number_to_human term['doc_count'] %> projects</small>
  <% end %>
</li>
